package com.kt.emall.search.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import static com.alibaba.nacos.api.common.Constants.TOKEN;

/**
 * Description: EmallElasticSearchConfig
 * Created with IntelliJ IDEA.
 *
 * @author: KamTeng
 * Date: 2021/8/5
 */
@Configuration
public class EmallElasticSearchConfig {

    public static final RequestOptions COMMON_OPTIONS;
    static {
        RequestOptions.Builder builder = RequestOptions.DEFAULT.toBuilder();
        COMMON_OPTIONS = builder.build();
    }

    @Bean
    public RestHighLevelClient esRestClient() {

        RestClientBuilder builder = null;
        builder = RestClient.builder(
                new HttpHost("192.168.56.11", 9200, "http"));
        return new RestHighLevelClient(builder);
    }
}